//
//  PersonalCenterController.m
//  Loan
//
//  Created by hejinhui on 2017/11/7.
//  Copyright © 2017年 hejinhui. All rights reserved.
//

#import "PersonalCenterController.h"
#import "PersonalCenterHeaderView.h"
#import "PerosnalCenterCell.h"

@interface PersonalCenterController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView *tableView;
@property(nonatomic,strong)NSArray *dataSource;
@end

@implementation PersonalCenterController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"个人中心";
    self.dataSource = @[
                        
  @{@"title":@"用户信息",@"icon":@"用户信息.png"},
  @{@"title":@"借款进度",@"icon":@"jiekuanjindu.png"},
  @{@"title":@"我的还款",@"icon":@"wodehuankuan.png"},
  @{@"title":@"还款银行卡",@"icon":@"huankuanyinhangka.png"},
  @{@"title":@"在线客服",@"icon":@"zaixiankefu.png"},
  @{@"title":@"关于我们",@"icon":@"guanyuwomen.png"}
  
  ];
    [self.view addSubview:self.tableView];
}
/*
 init tableView
 */
-(UITableView *)tableView
{
    if (!_tableView) {
        
        _tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        PersonalCenterHeaderView *headerV = [PersonalCenterHeaderView showPersonCenterHeaderView];
        headerV.frame = (CGRect){{0,0},{kScreenWidth,130}};
        _tableView.tableHeaderView = headerV;
    }
    return _tableView;
}

#pragma mark -- tableVIewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataSource.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
   
    PerosnalCenterCell *cell = [PerosnalCenterCell tableViewCellWithTableView:tableView];
    cell.titleLabel.text = self.dataSource[indexPath.row][@"title"];
    cell.icon.image = [UIImage imageNamed:self.dataSource[indexPath.row][@"icon"]];
    return cell;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    return nil;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    return nil;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.001f;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.001f;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60.f;
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
